package com.fm.demo.component

import android.annotation.SuppressLint
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
import android.widget.Toast
import com.binioter.guideview.Component
import com.fm.demo.R

/**
 * @CreateData:     2020/4/20 10:37
 * @E-Mail:         709674174@qq.com
 * @Author:         lyy
 * @Description:    类描述
 */
class MainActivityComponent : Component {

    @SuppressLint("InflateParams")
    override fun getView(context: Context): View {
        val view = LayoutInflater.from(context).inflate(R.layout.component_main, null)
        view.findViewById<TextView>(R.id.cm_tv_title).text = context.getString(R.string.app_name)
        view.setOnClickListener {
            Toast.makeText(view.context, "引导层被点击了", Toast.LENGTH_SHORT).show()
        }
        return view
    }

    override fun getAnchor(): Int {
        return Component.ANCHOR_BOTTOM
    }

    override fun getFitPosition(): Int {
        return Component.FIT_END
    }

    override fun getXOffset(): Int {
        return 0
    }

    override fun getYOffset(): Int {
        return 10
    }
}